package pl.matt.main;

import org.springframework.context.ApplicationContext;

import pl.matt.service.ExtractorService;
import pl.matt.service.VideoService;
import pl.matt.utils.ApplicationContextUtils;

public class Main2 {
	
	
	
	public static void main(String[] args) {
		String videoName = "testVideo";
		ApplicationContext applicationContext = ApplicationContextUtils.getApplicationContest();
		
		boolean extractFrames = false;
		boolean extractFaces = false;
		boolean extractRightEyes = true;
		boolean extractLeftEyes = true;
		
		if (extractFrames) {
			// wydobycie klatek
			VideoService videoService = (VideoService) applicationContext.getBean("videoService");
			videoService.extractFrames(videoName, "resources/movies/2009-08-10-010344.ogv");
		}
		if (extractFaces) {
			// rozpoznanie twarzy
			ExtractorService faceExtractorService = (ExtractorService) applicationContext.getBean("faceExtractorService");
			faceExtractorService.extractFromVideo(videoName);
		}
		
		// rozpoznanie oczu
		if (extractRightEyes) {
			ExtractorService eyeExtractorService = (ExtractorService) applicationContext.getBean("rightEyeExtractorService");
			eyeExtractorService.extractFromVideo(videoName);
		}

		if (extractLeftEyes) {
			ExtractorService eyeExtractorService = (ExtractorService) applicationContext.getBean("leftEyeExtractorService");
			eyeExtractorService.extractFromVideo(videoName);
		}
		
	}
}
